package meijuli.com.join51.business.utils;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.provider.Settings;

/**
 * Created by Administrator on 2017/2/28.
 * 权限帮助类
 *
 * @author jack
 */

public class PermissionUtils {
    private static volatile PermissionUtils instance;

    public static PermissionUtils getInstance() {
        if (instance == null) {
            synchronized (PermissionUtils.class) {
                if (instance == null) {
                    instance = new PermissionUtils();
                }
            }
        }
        return instance;
    }

    /**
     * 跳转到设置界面设置权限
     *
     * @param context
     */
    public void toSetting(Context context) {
        if(context == null) {
          return;
        }
        Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
        Uri uri = Uri.fromParts("package", context.getPackageName(), null);
        intent.setData(uri);
        context.startActivity(intent);
    }
}